package com.yanqu.road.server.cmd.marriage.crossworld;

import com.yanqu.road.entity.marriage.MarriageInfo;
import com.yanqu.road.logic.pb.MarriagePb;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.marriage.CrossMarriageProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.protocol.Protocol;
import com.yanqu.road.utils.YanQuMessageUtils;

@Cmd(code = Protocol.C_CROSS_WORLD_MARRIAGE_AGREE_RESP, desc = "跨服联姻同意响应（跨服商会分组）")
public class CrossWorldMarriageAgreeRespCmd extends CrossCommand {
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {

        CrossMarriageProto.CrossMarriageAgreeCrossDealRespMsg respMsg = CrossMarriageProto.CrossMarriageAgreeCrossDealRespMsg.parseFrom(packet.getBytes());
        MarriageInfo marriageInfo = MarriagePb.parseMarriageInfo(respMsg.getApplyData());
        YanQuMessage pbMsg = YanQuMessageUtils.buildMessage(Protocol.S_CROSS_WORLD_MARRIAGE_AGREE_RESP, respMsg);
        MessageHelper.sendPacket(marriageInfo.getServerId(), marriageInfo.getUserId(), pbMsg);
    }

    @Override
    public void sendData() {

    }
}
